import axios from "axios";
import sha1 from "sha1";

function getApi(url) {
  var app_id = "A6107876068110";
  var now = Date.now();
  var appKey =
    sha1(app_id + "UZ" + "58EBAF35-D1F8-D16D-C10F-3EFF74B31665" + "UZ" + now) +
    "." +
    now;
  return axios({
    method: "get",
    url,
    headers: {
      "X-APICloud-AppId": app_id,
      "X-APICloud-AppKey": appKey,
    },
  });
}
function postApi(url, data) {
  var app_id = "A6107876068110";
  var now = Date.now();
  var appKey =
    sha1(app_id + "UZ" + "58EBAF35-D1F8-D16D-C10F-3EFF74B31665" + "UZ" + now) +
    "." +
    now;
  return axios({
    method: "post",
    url,
    headers: {
      "X-APICloud-AppId": app_id,
      "X-APICloud-AppKey": appKey,
    },
    data,
  });
}

export { getApi, postApi };